<html>
<head>
<title>test</title>
<script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
</head>
<body>
<p>请输入两个数字</p>
{{ hello }}
GET:
<form action="/search/" method="get">
    {% csrf_token %}
        <input type="text" name="q">
        <input type="submit" value="Search">
 </form>
<br/>
POST:

<form action="/search_post/" method="post">
		{% csrf_token %}
		<input type="text" name="q">
		<input type="submit" value="Submit">
</form>

<p>{{ rlt }}</p>

<input type="button" value="button" id="button">
<br/>
<input type="button" value="requests测试" id="requests_id">

<script type="text/javascript">
    jQuery(function($){  
        $('#button').click(function(){
            alert('{{ csrf_token }}');
            $.post('/ajax_post/', {'csrfmiddlewaretoken': '{{ csrf_token }}'/*CSRF跨站请求伪造，CSRF认证 */}, function (text, status){
                alert(text.twz);
			});
        });

        $('#requests_id').click(function(){
            $.post('/requests_test/', {'csrfmiddlewaretoken': '{{ csrf_token }}'/*CSRF跨站请求伪造，CSRF认证 */}, function (text, status){
                alert(text.twz);
			});
        });
    }); 
</script>
</body>
</html>